<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<link type="text/css" href="./assets/styles/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>

		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			$('#btn-export').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.form1.csv.value="download";
					document.form1.submit();
					
				}
			});
			$('#btn-reset').click(function(){	
				location.href = document.form1.action;
			});
			
			$('#btn_search').click(function(){	
				document.form1.csv.value="";
				document.form1.submit();
			});
		});
		function toPage(thepage) {
			document.form1.page.value =  thepage;
			document.form1.csv.value="";
			document.form1.submit();
		}
		</script>

		</script>
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />
		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
	</head>
	<body id="">
{{$menu}}
{{$logout}}
		<div id="container"><div class="wrapper">
			<h2>PDFダウンロードサイト　チラシ(管理者用)</h2>
			<ul class="submenu clearfix">
				<li><a href="afcs_adm_store_view.php">店舗別検索</a></li>
				<li><a href="afcs_adm_map_view.php">マップグルーピング検索</a></li>
				<li><a href="afcs_adm_area_view.php">エリア別検索</a></li>
				<li><a href="afcs_adm_sc_view.php">チラシ版別検索（SC用）</a></li>
				<li><a href="afcs_index.php">TOP画面へ</a></li>
			</ul>
			<h3>エリア別検索</h3>

			<form name="form1" id="form1" method="get" action="afcs_adm_area_view.php" >
				<input type="hidden" name="page" />
				<table class="formTable searchTable">
					<tbody>
						<tr>
							<th>チラシ発行日</th>
							<td>
								<input type="text" name="upd_f" class="text_date" value="{{ $forms.upd_f }}" /> ～ 
								<input type="text" name="upd_t" class="text_date" value="{{ $forms.upd_t }}" />
							</td>
						</tr>
						<tr>
							<th>世話人コード</th>
							<td>
								<input type="text" name="pattern_name" value="{{ $forms.pattern_name }}" class="text" />
							</td>
						</tr>
					</tbody>
				</table>
				<p class="button" style="text-align:right">
					<button type="button" id="btn-reset"><span>クリア</span></button>
					<button type="button" id="btn_search" class="submit"><span>絞込検索</span></button>
				</p>
				<input type="hidden" name="search" value="1" />
				<input type="hidden" name="csv" />
			</form>


{{ if is_numeric($page.cnt) }}
{{ if $page.cnt > 0 }}

			<p class="message">{{ $page.cnt }}件の情報が見つかりました。</p>

			<span style="font-weight: bold;">{{ $forms.pattern_name }}</span>
			<p align="left">{{$pageing}}</p>

			<table id="search_result" class="sortable">
				<thead>
					<tr>
						<th><h3>店舗名</h3></th>
						<th><h3>発行日</h3></th>
						<th sytle="width:200px"><h3>タイトル</h3></th>
						<th><h3>サイズ</h3></th>
						<th><h3>印刷部数</h3></th>
						<th><h3>折込</h3></th>
						<th><h3>面</h3></th>
						<th><h3>管理No</h3></th>
					</tr>
				</thead>
				<tbody>
{{ foreach from=$data key=k item=v name="member" }}
					<tr>
						<td rowspan="2">{{ $v.shop_name }}<br>{{ $v.user_name }}</td>
						<td rowspan="2">{{ $v.flier_date }}</td>
						<td rowspan="2" sytle="width:200px">【{{ $v.groupid }}】{{ $v.title }}</td>
						<td rowspan="2" align="center">{{ $v.size }}</td>
						<td rowspan="2" align="center">{{ $v.pnums }}</td>
						<td rowspan="2" align="center">{{ $v.pattern_name }}</td>
						<td  align="center" sytle="width:10px">表</td>

						{{assign var="aa" value=$v.flier_date}}
						{{assign var="a" value=$v.flier_date|substr:2:6}}
						{{assign var="b" value=$v.mano_out}}
						{{assign var="c" value="./pdf/`$aa`/`$a``$b`.pdf"}}

						{{if file_exists($c) == "1"}}
						<td align="center"><a href="./pdf/{{$v.flier_date}}/{{$v.flier_date|substr:2:6}}{{ $v.mano_out }}.pdf" target="_blank" style="text-decoration:underline;">{{$v.flier_date|substr:2:6}}{{ $v.mano_out }}</a></td>
						{{else}}
						<td align="center"><font color="red">ファイルUPエラー：{{$c}}</font></td>
						{{/if}}
					</tr>
					<tr>

						<td align="center">裏</td>

						{{assign var="dd" value=$v.flier_date}}
						{{assign var="d" value=$v.flier_date|substr:2:6}}
						{{assign var="e" value=$v.mano_out}}
						{{assign var="f" value="./pdf`$dd`/`$d``$e`.pdf"}}

						{{if file_exists($f) == "1"}}
						<td align="center"><a href="./pdf/{{$v.flier_date}}/{{$v.flier_date|substr:2:6}}{{ $v.mano_in }}.pdf" target="_blank" style="text-decoration:underline;">{{$v.flier_date|substr:2:6}}{{ $v.mano_in }}</a></td>
						{{else}}
						<td align="center"><font color="red">ファイルUPエラー：{{$f}}</font></td>
						{{/if}}
					</tr>



{{ /foreach }}
				</tbody>
			</table>

			<p align="right">{{$pageing}}</p>

{{ else }}
<p class="message">条件にマッチする情報は見つかりませんでした。</p>
{{ /if }}
{{ else }}
	<p class="message">ここに検索結果が表示されます。</p>
{{ /if }}
			<!--
			<p class="button">
				<button type="button" class="btn_return" class="submit"><span>戻る</span></button>
			</p>
			-->


		</div></div>
		{{ $footer }}
	</body>
</html>